<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>


<!-- Mirrored from www.zi-han.net/theme/hplus/projects.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:44 GMT -->
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>文章管理</title>
    <meta name="keywords" content="文章后台">
    <meta name="description" content=">

    <link rel="shortcut icon" href="/furniture/Public/Admin/favicon.ico"> 
    <link href="/furniture/Public/Admin/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="/furniture/Public/Admin/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="/furniture/Public/Admin/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="/furniture/Public/Admin/css/animate.min.css" rel="stylesheet">
    <link href="/furniture/Public/Admin/css/css.css" rel="stylesheet">
    <link href="/furniture/Public/Admin/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <style>
      th{
        text-align: center;
      }
    </style>

</head>

<body class="gray-bg">

    <div class="wrapper wrapper-content animated fadeInUp">
        <div class="row">
            <div class="col-sm-12">

                <div class="ibox">
                    <div class="ibox-title">
                        <h5>文章列表</h5>
                        <div class="ibox-tools">
                            <a href="<?php echo U('Admin/Article/article_add');?>" class="btn btn-primary btn-xs">添加新文章</a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <div class="row m-b-sm m-t-sm">
                            <div class="col-md-1">
                                <button type="button" id="loading-example-btn" class="btn btn-white btn-sm"><i class="fa fa-refresh"></i> 刷新</button>
                            </div>

                            <div class="col-md-11">
                                <div class="input-group">
                                    <input id="art_title" type="text" placeholder="请输入标题关键字"  value="" class="input-sm form-control">
                                    <span class="input-group-btn"><button id="search" type="submit" class="btn btn-sm btn-primary" name="search" value="1"> 搜索</button></span>
                                </div>
                            </div>
                        </div>

                        <div class="project-list">
                            <table class="table table-hover" style="text-align:center">
                                <tbody>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="/furniture/Public/Admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="/furniture/Public/Admin/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="/furniture/Public/Admin/js/content.min.js?v=1.0.0"></script>
    <script src="/furniture/Public/Admin/js/plugins/sweetalert/sweetalert.min.js"></script>
    <script>
        //删除
        $(document).on('click','.del',function(){
			//获取属性a_id的值
          var a_id=$(this).attr('a_id');
            swal({
                title: "您确定要删除这个文章吗",
                text: "删除后将无法恢复，请谨慎操作！",
                type: "warning",
                showCancelButton: true,
                confirmButtonColor: "#1647a1",
                confirmButtonText: "确定",
                cancelButtonText: "返回",
                closeOnConfirm: false,
                closeOnCancel: true,
            }, 
            function(isConfirm) {
                if (isConfirm){
                    //点击确认之后执行的代码
                    $.ajax({
                        type:'get',
                        url:"<?php echo U('Admin/Article/article_del');?>",
                        data:'a_id='+a_id,
                        dataType:'text',
                        success:function(z){
                            console.log(z);
                            if(z==1){
                                swal("删除成功！", "您已经永久删除了这条信息。", "success")
                                function aa(){
                                    $('#loading-example-btn').click();
                                }
                                setTimeout(aa,1500);
                            }else{
                                swal("数据执行有误", "请联系客服", "error")
                            }
                        }
                    })
                } else {
                    //点击取消之后执行的代码
                    swal("已取消", "您取消了删除操作！", "error")
                }
            })
        });

       $(document).ready(function(){$("#loading-example-btn").click(function(){btn=$(this);simpleLoad(btn,true);simpleLoad(btn,false)})});function simpleLoad(btn,state){if(state){btn.children().addClass("fa-spin");btn.contents().last().replaceWith(" Loading")}else{setTimeout(function(){btn.children().removeClass("fa-spin");btn.contents().last().replaceWith(" Refresh")},2000)}};
       $('#loading-example-btn').click(function(){
        location.reload();
       })
    </script>
    <script>
        //查询默认的文章列表数据
        $.ajax({
            type:'get',
            url:"<?php echo U('Admin/Article/article_ajax');?>",
            data:'',
            dataType:'html',
            success:function(z){
                // console.log(z);
                $('.table tbody').html(z);//在tbody标签输出article_ajax方法输出的东西
            }
        })
        //分页的点击ajax，注意查看分页的class名
        $(document).on('click','.digg a',function(){
            var href=$(this).attr('href');//拿到当前分页a标签href属性的值
            $.ajax({
                type:'get',
                url:href,
                data:'',
                dataType:'html',
                success:function(z){
                    //console.log(z);
                    $('.table tbody').html(z);//在tbody标签输出article_ajax方法输出的东西
                }
            })
            return false;//组织a链接跳转页面
        })
        //浏览数排序
        var b=true;
        $(document).on('click','#pageview',function(){
            //点击一下正序
            var ord;
            if(b){
                ord=1;//正序
                b=false;
            }else{
                ord=2;//倒序
                b=true;
            }
            //console.log(ord);
            $.ajax({
                type:'get',
                url:"<?php echo U('Admin/Article/article_ajax');?>",
                data:'value=0&ord='+ord,
                dataType:'html',
                success:function(z){
                    // console.log(z);
                    $('.table tbody').html(z);//在tbody标签输出article_ajax方法输出的东西
                    if(b){
                    }else{
                        //修改箭头
                        $('.glyphicon').removeClass('glyphicon-triangle-bottom').addClass('glyphicon-triangle-top');
                    }
                }
            })
        })

        //显示修改
        $(document).on('click','.is_show',function(){
          var id=$(this).attr('data_id');
          var show=$(this).attr('data_value');
          if(show==1){
            $(this).attr('data_value',2);//表示当前状态的值
            $(this).find('img').attr('src','/furniture/Public/Admin/img/no.png');
          }else{
            $(this).attr('data_value',1);//表示当前状态的值
            $(this).find('img').attr('src','/furniture/Public/Admin/img/yes.png');
          }
          $.ajax({
            type:'get',
            url:'<?php echo U("Admin/Article/article_ajax_show");?>',
            data:'id='+id+'&show='+show,
            dataType:'text',
            success:function(z){
              console.log(z);
            }
          })
        })
        //标题修改
        $(document).on('click','.art_title',function(){
            $(this).addClass('art_on');
            $(this).find('input').removeAttr('readonly');
        })
        $(document).on('blur','.art_title input',function(){
            $(this).parent('.art_title').removeClass('art_on');
            $(this).attr('readonly','readonly');
            var value=$(this).val();
            var id=$(this).attr('data_id');
            $.ajax({
            type:'get',
            url:'<?php echo U("Admin/Article/article_ajax_title");?>',
            data:'id='+id+'&value='+value,
            dataType:'text',
            success:function(z){
                console.log(z);
            }
            })
        })
        //搜索文章标题
        $(document).on('click','#search',function(){
            var value=$('#art_title').val();
            // console.log(value);
            $.ajax({
                type:'get',
                url:"<?php echo U('Admin/Article/article_ajax');?>",
                data:'value='+value,
                dataType:'html',
                success:function(z){
                    //console.log(z);
                    $('.table tbody').html(z);
                }
            })
        })
    </script>
    <style>
        .art_title input{
          width:100%;
          height:20px;
          line-height:20px;
          border:none;
          outline:none;
          background:rgba(255,255,255,0);
        }
        .art_on input{
            border:1px solid #666;
            outline:blue;
            background:rgba(255,255,255,0.8);
        }
        #pageview{
            cursor:pointer;
            border-bottom: 1px solid;
            padding-bottom: 3px;
        }
        #pageview:hover{
            color:#337ab7;
        }
    </style>
    </body>

<!-- Mirrored from www.zi-han.net/theme/hplus/projects.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:44 GMT -->
</html>